package com.example.smartcity4.ui.user;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.smartcity4.R;


public class UserFragment extends Fragment implements View.OnClickListener {

   private View view;
    private TextView title;
    private ImageView left;
    private ImageView image;
    private ImageView item1;
    private ImageView item2;
    private ImageView item3;
    private ImageView item4;
    private Button btn;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
      view=inflater.inflate(R.layout.fragment_user, container, false);
      initView();
        return view;
    }

    private void initView() {

        title = view.findViewById(R.id.title);
        left = view.findViewById(R.id.left);
        image = view.findViewById(R.id.image);
        item1 = view.findViewById(R.id.item1);
        item2 = view.findViewById(R.id.item2);
        item3 = view.findViewById(R.id.item3);
        item4 = view.findViewById(R.id.item4);
        btn = view.findViewById(R.id.btn);
        title.setText("个人中心");
        item1.setOnClickListener(this);
        item2.setOnClickListener(this);
        item3.setOnClickListener(this);
        item4.setOnClickListener(this);
        btn.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.item1:
                startActivity(new Intent(getContext(),InfoActivity.class));
                break;
            case R.id.item2:
                startActivity(new Intent(getContext(),PasswordActivity.class));
                break;
            case R.id.item3:
                startActivity(new Intent(getContext(),OrderActivity.class));
            case R.id.item4:
                startActivity(new Intent(getContext(),QuestActivity.class));
            case R.id.btn:
                startActivity(new Intent(getContext(),LoginActivity.class));

        }

    }
}